import Vue from "vue";
import "../../utils/weui";
import com from "../../utils/common"
let editAddFooter = {};
editAddFooter.Temp = `
<div class="add-msg">
    <div class="activity_des" v-if="footeradd.Mobile || footeradd.Mobile == ''">
        <div class="activity_des_title">
            <h2 class="f1">咨询电话</h2>
        </div>
        <div class="activity_des_content connect_mobile">
            <input name='contact' number id="mobile" class="fl contactmobile" v-model="footeradd.Mobile"
                   placeholder="0571-88613816">
            <p class="fr">只能添加一个手机号或固话,方便顾客咨询</p>
        </div>
    </div>
    <div class="activity_des" v-if="footeradd.Other">
        <div class="activity_des_title">
            <h2 class="f1">信息采集</h2>
        </div>
        <div class="activity_des_content">
            <div>
                <div class="must_message">
                    <p class="fl">姓名</p>
                    <img class="fr" src="../../../img/activity/element-lock@2x.png"
                         alt="">
                </div>
                <div class="both"></div>
                <div class="must_message">
                    <p class="fl">手机号码</p>
                    <img class="fr" src="../../../img/activity/element-lock@2x.png"
                         alt="">
                </div>
                <p class="must_message_des">姓名和手机号为必选项,不可修改</p>
            </div>
            <div class="select_message">
                <div  v-for="(item,index) in footeradd.Other">
                    <div class="b_select_message">
                        <input type="text" name='more' class="fl b_select_message_input"
                        placeholder="填写要收集的信息名称" v-model="item.Name">
                        <div class=" weui_cells_checkbox fr">
                            <label class="weui_cell weui_check_label check_label_box" :for="'s' + index">
                              <input type="checkbox" class="weui_check" :id="'s' + index"
                                   v-model="item.IsMust"
                                   v-on:click="checkbox(item.IsMust)">
                              <i class="weui_icon_checked"></i>
                              <div class="weui_cell_bd weui_cell_primary">
                                <p class="fl">&nbsp;必填项</p>
                              </div>
                            </label>
                        </div>
                    </div>
                    <div class="both"></div>
                </div>
                <p class="select_message_des" style="color: #f00;">谨慎设定自定义信息收集，要求填写过多信息，报名数将大大降低。</p>
                <p class="select_message_des">自定义项为空则不显示,最多可填6个字,勾选必填项,则为必填,不勾选则为选填,不可修改</p>
            </div>
        </div>
    </div>
</div>
`;
let EditAddMsg = Vue.extend({
  template: editAddFooter.Temp,
  props: ["footeradd"],
  mounted(){
    let actid = com.getUrlParam("actid") ? com.getUrlParam("actid") : 1;
    if(actid <= 1){
      let self = this;
      com.ajax({
        url:"/user/userMobile",
        ok:function (data) {
          if(data["msg"] == "ok"){
            self.footeradd.Mobile = data["Mobile"]
          }
        }
      })
    }
  },
  methods: {
    checkbox: function (item) {
      item = !item;
    },
  }
});
export default EditAddMsg;
